home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Tools / SFX-Player / Mpeg / MrMPEG / Insert.rexx < prev    next >
OS/2 REXX Batch file  |  2000-05-08  |  3KB  |  67 lines

  1. /* Insert.rexx */
  2.  
  3. options results; address MrMPEG
  4.  
  5. MUIA_List_Active    = 0x8042391c;    MUIA_List_Entries    = 0x80421654
  6. MUIA_ShowMe        = 0x80429ba8;    MUIV_List_Active_Top    = -2
  7.  
  8. list ID SLIST ATTRS MUIA_List_Entries; entries = result
  9. popasl ID FPATH; fpath = result
  10. temp_name = TmpFile('PIPE:MPEG_List.')
  11. address command 'RequestFile >'temp_name 'DRAWER' fpath 'PATTERN "#?.(mp1|mp2|mp3)"
  12.   TITLE "Select MPEG files" MULTISELECT NOICONS'
  13. if open('SongList', temp_name, 'r') = 1 then do
  14.   temp_list = readln('SongList')
  15.   call close('SongList')
  16.   if temp_list ~= "" then do
  17.     do forever
  18.       parse var temp_list '"' first '"' temp_list
  19.       if first == '' then leave
  20.       if exists(first) then do
  21.         popasl ID PATH; pathname = result
  22.         temp_name = TmpFile('PIPE:MPEG_Temp.')
  23.         address command pathname'MPEGA -h' first '>'temp_name
  24.         if open('Output', temp_name, 'r') = 1 then do    /* Check if it can read song info or not */
  25.           null = readln('Output')
  26.           null = readln('Output')
  27.           null = readln('Output')
  28.           null = readln('Output')
  29.           info = readln('Output')
  30.           length = readln('Output')
  31.           call close('Output')
  32.           if left(info, 13) =  '   File Type:' then do
  33.             parse var info dummy':' ''detail''
  34.             parse var length dummy':' ''temp_total_time''
  35.             list ID SLIST ATTRS MUIA_List_Active
  36.             if entries = 0 then result = result + 1
  37.             list ID SLIST INSERT NODUP POS result,
  38.               STRING first","temp_total_time","strip(detail)
  39.           end /* of if info */
  40.           else request ID WARN GADGETS '"OK"' '"Corrpted MPEG file."'
  41.         end /* of if open */
  42.         else request ID WARN GADGETS '"OK"' '"Could not open a pipe."'
  43.       end /* of if exists */
  44.       else do
  45.         temp_string = "Could not open the file '"first"'."
  46.         request ID WARN GADGETS '"OK"' temp_string
  47.       end
  48.     end /* of do forever */
  49.     list ID SLIST ATTRS MUIA_List_Entries; temp_max = result
  50.     setvar max temp_max
  51.     text ID MAX LABEL "\033b\033r"right(temp_max, 3)
  52.     temp_total_time = 0
  53.     do i = 0 to temp_max - 1
  54.       list ID SLIST POS i
  55.       parse var result dummy','temp_song_time','dummy2
  56.       temp_total_time = temp_total_time + left(temp_song_time, 2) * 60 + right(temp_song_time, 2)
  57.     end
  58.     temp_string = right(temp_total_time % 3600, 2, 0)||":"||,
  59.         right(temp_total_time // 3600 % 60, 2, 0)":"right(temp_total_time // 60, 2, 0)
  60.     setvar total_time temp_string
  61.     text ID TOTAL LABEL "\033b\033r"temp_string
  62.     if entries = 0 then list ID SLIST ATTRS MUIA_List_Active MUIV_List_Active_Top
  63.   end /* of if temp_list */
  64. end /* of if open */
  65. else request ID WARN GADGETS '"OK"' '"Could not open a pipe."'
  66. return
  67.